//1.导入模块
import instance from '@/utils/axios.js'
//.2编写登录接口
const userLogin = ({ mobile, code }) => {
  //相当于let {mobile, code}=value
  return instance({
    url: '/v1_0/authorizations',
    method: 'post',
    data: { mobile, code }
  })
}

//导出接口
export { userLogin }

//获取用户个人信息
//导入token.js工具包
import { getItem } from '@/utils/token.js'

const getUserInfo = () => {
  return instance({
    url: '/v1_0/user/profile',
    method: 'get',
    //设置请求头
    headers: {}
  })
}
//导出
export { getUserInfo }

//编辑用户个人信息
//导入token.js工具包
const editUserInfo = Obj => {
  return instance({
    url: '/v1_0/user/profile',
    method: 'patch',
    data: Obj,
    //设置请求头
    headers: {}
  })
}
//导出
export { editUserInfo }

//编辑用户头像
//导入token.js工具包
const editUserAvatar = fd => {
  return instance({
    url: '/v1_0/user/photo',
    method: 'PATCH',
    data: fd,
    //设置请求头
    headers: {}
  })
}
//导出
export { editUserAvatar }
